<script type="text/javascript">
	addTab("<?php echo Core_Util::escapeForJs2($this->contest->getTitle())?>",'<?php echo $this->url(array('controller' => 'entry', 'action' => 'list', 'id_entry' => null))?>')
	
    var msg_notice = '<?php echo $this->translate("MSG_NOTICE"); ?>'
    
    function showPopUpDialog(options)
    {
        Social.getDialog().create({
            'title'     : msg_notice,
            'content'   : options.content,
            'buttons'	: {
                "OK": function(){
                    $(this).dialog("close");
                }
            }
        });
    }
    
    $(document).ready(function(){
        canvasScrollTo(0,0);
        
		$('input[name="candidate[<?php echo $this->index_dob;?>]"]').datepicker({
			dateFormat: '<?php echo BIRTHDAY_FORMAT_JS; ?>',
			yearRange: "-50:+0",
			changeMonth: true,
			changeYear: true
		});
		$('input[type=submit]').click(function(){
			if($.trim($('#title').val())=='')
			{
				showPopUpDialog({
                    'content': '<?php echo $this->translate('ERROR_EMPTY_TITLE');?>'
                });
				$('#title').focus();
				return false;
			}
			if($('#title').length>255)
			{
				showPopUpDialog({
                    'content': '<?php echo $this->translate('ERROR_EXCEED_MAXLENGTH_TITLE');?>'
                });
				$('#title').focus();
				return false;
			}
			<?php 
				if(!empty($this->validate_script)):
					echo $this->validate_script;
				endif;
			?>
		});
	});
</script>

<?php if (isset($this->success_message)): ?>
	<div class="sm_message_panel">
		<p class="header">&nbsp;&nbsp;<?php echo $this->success_message; ?></p>
	</div>
<?php endif; ?>
<div class="submission_image" style="text-align: center;">
	<?php if(APP_INSTANCE == APP_INSTANCE_IMAGE):?>
    <img   alt="<?php echo $this->escape($this->entry->title); ?>" src="<?php echo $this->entry->getSubmissionImageUrl(); ?>" />
	<?php else: ?>
		<?php echo $this->entry->getEmbeddedCode() ?>
	<?php endif;?>
</div>
<?php echo $this->form;?>